package day7;

import java.io.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class SchoolTest {
    public static void main(String[] args) {
        //怎么把int,double,float写入文件。。。
        String str=String.valueOf(144);
        //RandomAccessFile
        try {
//            System.out.println(Double.toHexString(Math.E));
//            System.out.println(Integer.toHexString(1000000));
            DataOutputStream dout=new DataOutputStream(new FileOutputStream("F:/java82/data.txt"));
            dout.writeInt(1000000);
            dout.writeDouble(Math.E);
            dout.writeBoolean(2>1);
            dout.writeByte(97);
            dout.writeUTF("We change lives");
            dout.close();

            DataInputStream din=new DataInputStream(new FileInputStream("F:/java82/data.txt"));
            int i=din.readInt();
            double d=din.readDouble();
            boolean b=din.readBoolean();
            byte b2=din.readByte();
            String string=din.readUTF();
            din.close();
            System.out.println(i);
            System.out.println(d);
            System.out.println(b);
            System.out.println(b2);
            System.out.println(string);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
